
var btn_pos_html = '<button id="btn_pos" name="btn_pay" type="button" class="btn btn-default" onclick="btn_pos_click()">POS</button>';

var div = document.getElementById("div_pay_method_select_wl_112233");

if (div){
	div.innerHTML = div.innerHTML + btn_pos_html;

	var port = chrome.extension.connect();

	div.addEventListener('start_pos_event', function() {
		console.log(port)
		// port.postMessage({message: "start_pos_event", values: 1});
	});
};

document.addEventListener('start_pos_event', function(evt) {  
	console.log(1)
	chrome.runtime.sendMessage({type: "launch", message: evt.detail}, function(response) {  
	  	console.log(2)
	});  
}, false);
